package Thread;

import java.util.PriorityQueue;
import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int k = in.nextInt();
            int[] a = new int[n];
            int ans = 0;
            PriorityQueue<Integer> heap = new PriorityQueue<>((v1,v2) -> v2 - v1);
            for(int i = 0;i < n;i++) {
                a[i] = in.nextInt();
                if(a[i] % 2 == 1) ans += a[i];
                //将偶数放入大根堆中
                else heap.add(a[i]);
            }
            while(k > 0 && !heap.isEmpty()) {
                int tmp = heap.poll();
                if((tmp / 2) % 2 == 0) heap.add(tmp / 2);
                else ans += tmp / 2;
                k--;
            }
            //处理堆中剩下的数
            while(!heap.isEmpty()) {
                ans += heap.poll();
            }
            System.out.println(ans);
        }
    }
}

